package main

import (
	"context"
	"fmt"
	"github.com/micro/go-micro/v2"
	"greeter/proto/llqhz"
)

func main() {
	// 实例化
	service := micro.NewService(
		micro.Name("micro.client.greeter"),
	)

	// 初始化
	service.Init()

	// 创建服务
	greeterService := llqhz.NewGreeterService("micro.service.greeter", service.Client())

	// 调用服务
	response, err := greeterService.SayHello(context.TODO(), &llqhz.SayRequest{
		Message: "学习GoLang微服务",
	})
	if err != nil {
		panic(err)
	}
	fmt.Println(response.Answer)
}
